<template>
  <div class="main-table">
    <Row class="flex space-between">
      <Col span="8 flex">
        <div class="text-label">清单流水号</div>
        <div class="valbox"></div>
      </Col>
      <Col span="8 flex">
        <div class="text-label">定点医疗机构名称</div>
        <div class="valbox">{{ form?.head?.hospitalName }}</div>
      </Col>
      <Col span="8 flex">
        <div class="text-label">定点医疗机构代码</div>
        <div class="valbox">{{ form?.head?.hospitalCode }}</div>
      </Col>
    </Row>
    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="8 flex">
        <div class="text-label">医保结算等级</div>
        <div class="valbox">{{ form?.head?.level }}</div>
      </Col>
      <Col span="8 flex">
        <div class="text-label">医保编码</div>
        <div class="valbox">{{ form?.head?.insureCode }}</div>
      </Col>
      <Col span="8 flex">
        <div class="text-label">病案号</div>
        <div class="valbox">{{ form?.head?.number }}</div>
      </Col>
    </Row>
    <Row style="margin-top: 15px" class="flex">
      <Col span="10 flex">
        <div class="text-label">申报时间</div>
        <div class="valbox">{{ $timeFilter(form.head.declareTime, 'format5') }}</div>
        年
        <div class="valbox">{{ $timeFilter(form.head.declareTime, 'format6') }}</div>
        月
        <div class="valbox">{{ $timeFilter(form.head.declareTime, 'format7') }}</div>
        日
      </Col>
    </Row>
    <div class="title1">一、基本信息</div>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="4 flex">
        <div class="text-label"><i class="red">*</i> 姓名</div>
        <div class="valbox">{{ form?.basicInfo?.realName }}</div>
      </Col>
      <Col span="4 flex">
        <div class="text-label"><i class="red">*</i> 性别</div>
        <div class="valbox">{{ sexEnum[form?.basicInfo?.sex] }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label">出生日期</div>
        <div class="valbox">
          {{ form?.basicInfo?.year }}
        </div>
        年
        <div class="valbox">
          {{ form?.basicInfo?.month }}
        </div>
        月
        <div class="valbox">
          {{ form?.basicInfo?.day }}
        </div>
        日
      </Col>

      <Col span="4 flex">
        <div class="text-label">年龄</div>
        <div class="valbox">{{ form?.basicInfo?.age }}</div>
        岁
      </Col>

      <Col span="4 flex">
        <div class="text-label">国籍</div>
        <div class="valbox">{{ gjInfoEnum[form?.basicInfo?.coutry] }}</div>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="7 flex">
        <div class="text-label">（年龄不足1周岁）年龄</div>
        <div class="valbox">{{ form?.basicInfo?.age_New }}</div>
        天
      </Col>

      <Col span="4 flex">
        <div class="text-label"><i class="red">*</i> 民族</div>
        <div class="valbox">{{ mzInfoEnum[form?.basicInfo?.nation] }}</div>
      </Col>

      <Col span="5 flex">
        <div class="text-label"><i class="red">*</i> 证件类别</div>
        <div class="valbox">{{ certTypeEnum[form?.basicInfo?.certType] }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label"><i class="red">*</i> 证件号码</div>
        <div class="valbox">{{ form?.basicInfo?.certNo }}</div>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="8 flex">
        <div class="text-label"><i class="red">*</i> 职业</div>
        <div class="valbox">{{ zyEnum[form?.basicInfo?.jobType] }}</div>
      </Col>

      <Col span="16 flex">
        <div class="text-label"><i class="red">*</i> 现住址</div>
        <div class="valbox">{{ form?.basicInfo?.homeAddress }}</div>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="8 flex">
        <div class="text-label">工作单位及地址</div>
        <div class="valbox">{{ form?.basicInfo?.jobName }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label">单位电话</div>
        <div class="valbox">{{ form?.basicInfo?.jobPhone }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label">邮编</div>
        <div class="valbox">{{ form?.basicInfo?.jobPostCode }}</div>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="5 flex">
        <div class="text-label">联系人姓名</div>
        <div class="valbox">{{ form?.basicInfo?.contactName }}</div>
      </Col>

      <Col span="3 flex">
        <div class="text-label">关系</div>
        <div class="valbox">{{ gxEnum[form?.basicInfo?.contactType] }}</div>
      </Col>

      <Col span="11 flex">
        <div class="text-label">地址</div>
        <div class="valbox">{{ form?.basicInfo?.contactAddress }}</div>
      </Col>
      <Col span="5 flex">
        <div class="text-label">电话</div>
        <div class="valbox">{{ form?.basicInfo?.contactPhone }}</div>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="8 flex">
        <div class="text-label"><i class="red">*</i> 医保类型</div>
        <div class="valbox">{{ ybEnum[form?.basicInfo?.insureType || ''] }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label">科技人员类型</div>
        <div class="valbox">{{ tsEnum[form?.basicInfo?.specialType || ''] }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label">参保地</div>
        <div class="valbox">{{ form?.basicInfo?.joinArea }}</div>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="8 flex">
        <div class="text-label">新生儿入院类型</div>
        <div class="valbox">{{ xhEnum[form?.basicInfo?.newBornInType || ''] || '' }}</div>
      </Col>

      <Col span="8 flex">
        <div class="text-label">新生儿出生体重</div>
        <div class="valbox">{{ form?.basicInfo?.newBornOutWeight }}</div>
        克
      </Col>

      <Col span="8 flex">
        <div class="text-label">新生儿入院体重</div>
        <div class="valbox">{{ form?.basicInfo?.newBornInWeight }}</div>
        克
      </Col>
    </Row>

    <div class="title1">二、门诊慢特病诊疗信息</div>
    <Row style="margin-top: 15px" class="flex space-between">
      <Col span="12 flex">
        <div class="text-label">诊断科别</div>
        <div class="valbox"></div>
      </Col>
      <Col span="12 flex">
        <div class="text-label">就诊日期</div>
        <div class="valbox"></div>
      </Col>
    </Row>

    <div style="margin-top: 20px">
      <Table :columns="columns1" :data="form?.specialDiagInfos" border=""></Table>
    </div>

    <div class="title1">三、住院诊疗信息</div>

    <div class="inhoinfo">
      <Row style="margin-top: 15px" class="flex row-border border-bottom-none">
        <Col span="4" class="text-label ivu-text-left"><i class="red">*</i> 住院医疗类型 </Col>
        <Col class="valbox" span="3">
          {{ Enum1[form?.diagInfo?.medicalType] || '' }}
        </Col>
        1.住院 2.日间手术
      </Row>
      <Row class="flex row-border border-bottom-none">
        <Col span="3" class="text-label ivu-text-left"><i class="red">*</i> 入院途径 </Col>
        <Col class="valbox" span="3">
          {{ Enum2[form?.diagInfo?.way] || '' }}
        </Col>
        1.急诊 2.门诊 3.其他医疗机构转入 4.其他
      </Row>
      <Row class="flex row-border border-bottom-none">
        <Col span="3" class="text-label ivu-text-left"> 治疗类别</Col>
        <Col class="valbox" span="3">
          {{ Enum3[form?.diagInfo?.healType || ''] }}
        </Col>
        1.西医 2.1中医 2.2民族医 3.中西医
      </Row>
      <Row class="flex space-between row-border border-bottom-none">
        <Col span="8 flex">
          <div class="text-label"><i class="red">*</i> 入院时间</div>
          <div class="valbox">
            {{ $timeFilter(form.diagInfo.inTime, 'format5') }}
          </div>
          年
          <div class="valbox">
            {{ $timeFilter(form.diagInfo.inTime, 'format6') }}
          </div>
          月
          <div class="valbox">
            {{ $timeFilter(form.diagInfo.inTime, 'format7') }}
          </div>
          日
        </Col>
        <Col span="8 flex">
          <div class="text-label"><i class="red">*</i> 入院科别</div>
          <div class="valbox">{{ classMethod(form?.diagInfo?.inCategory) }}</div>
        </Col>
        <Col span="8 flex">
          <div class="text-label">转科科别</div>
          <div class="valbox">{{ classMethod(form?.diagInfo?.turnCategory) }}</div>
        </Col>
      </Row>
      <Row class="flex space-between row-border border-bottom-none">
        <Col span="8 flex">
          <div class="text-label"><i class="red">*</i> 出院时间</div>
          <div class="valbox">
            {{ $timeFilter(form.diagInfo.outTime, 'format5') }}
          </div>
          年
          <div class="valbox">
            {{ $timeFilter(form.diagInfo.outTime, 'format6') }}
          </div>
          月
          <div class="valbox">
            {{ $timeFilter(form.diagInfo.outTime, 'format7') }}
          </div>
          日
        </Col>
        <Col span="8 flex">
          <div class="text-label"><i class="red">*</i> 出院科别</div>
          <div class="valbox">{{ classMethod(form?.diagInfo?.outCategory) }}</div>
        </Col>
        <Col span="8 flex">
          <div class="text-label"><i class="red">*</i> 实际住院</div>
          <div class="valbox">{{ form.diagInfo.inDays }}</div>
          天
        </Col>
      </Row>
      <Row class="flex space-between row-border">
        <Col span="14 flex">
          <div class="text-label">门（急）诊诊断（西医诊断）</div>
          <div class="valbox">{{ form.diagInfo.in_WM_Diag }}</div>
        </Col>
        <Col span="10 flex">
          <div class="text-label">疾病代码</div>
          <div class="valbox">{{ form?.diagInfo?.in_WM_Code }}</div>
        </Col>
      </Row>

      <Row class="flex space-between" style="padding: 12px 0">
        <Col span="14 flex">
          <div class="text-label">门（急）诊诊断（中医诊断）</div>
          <div class="valbox">{{ form.diagInfo.in_TCM_Diag }}</div>
        </Col>
        <Col span="10 flex">
          <div class="text-label">疾病代码</div>
          <div class="valbox">{{ form?.diagInfo?.in_TCM_Code }}</div>
        </Col>
      </Row>

      <Table :columns="columns2" :data="groupedItems" border>
        <template #redName="{ row, index }">
          <span>
            {{ row[0].type == 1 ? '主要诊断' : '其他诊断' + index }}：{{
              groupedItems[index][0].name
            }}
          </span>
        </template>
        <template #redCode="{ index }">
          <span>
            {{ groupedItems[index][0].code }}
          </span>
        </template>
        <template #redDesc="{ index }">
          <span>
            {{ groupedItems[index][0].desc }}
          </span>
        </template>
        <template #greenName="{ row, index }">
          <span> {{ row[0].type == 1 ? '主病' : '主证' }}：{{ groupedItems[index][1].name }} </span>
        </template>
        <template #greenCode="{ index }">
          <span>
            {{ groupedItems[index][1].code }}
          </span>
        </template>
        <template #greenDesc="{ index }">
          <span>
            {{ groupedItems[index][1].desc }}
          </span>
        </template>
      </Table>

      <Row class="flex" style="padding: 12px 0">
        <Col span="5" class="text-label ivu-text-left">诊断代码计数</Col>
        <Col class="valbox" span="6">
          {{ groupedItems ? groupedItems.length : 0 }}
        </Col>
      </Row>

      <div v-for="(item, index) in form.diagInfo.operItems" :key="index" class="opertion_list">
        <div class="table-container">
          <table class="my-table">
            <thead>
              <tr>
                <th>
                  {{ item.type == 1 ? '主要' : '其他' }}手术及操作名称{{
                    item.type == 1 ? '' : index
                  }}
                </th>
                <th>
                  {{ item.type == 1 ? '主要' : '其他' }}技术及操作代码{{
                    item.type == 1 ? '' : index
                  }}
                </th>
                <th>麻醉方式</th>
                <th>术者医生姓名</th>
                <th>术者医生代码</th>
                <th>麻醉医生姓名</th>
                <th>麻醉医生代码</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>
                  {{ form.diagInfo.operItems[index].operName || '' }}
                </td>
                <td>
                  {{ form.diagInfo.operItems[index].operCode }}
                </td>
                <td>
                  {{ mzfsInfoEnum[form.diagInfo.operItems[index].way] }}
                </td>
                <td>
                  {{ form.diagInfo.operItems[index].operDocName }}
                </td>
                <td>
                  {{ form.diagInfo.operItems[index].operDocCode }}
                </td>
                <td>
                  {{ form.diagInfo.operItems[index].anesDocName }}
                </td>
                <td>
                  {{ form.diagInfo.operItems[index].anesDocCode }}
                </td>
              </tr>
            </tbody>
          </table>
        </div>

        <Row class="flex space-between" style="padding: 12px 0">
          <Col span="5" class="text-label ivu-text-left">手术及操作起始时间</Col>
          <Col class="valbox" span="6">{{ item.operTime }} </Col>
          <Col span="5" class="text-label ivu-text-left">麻醉起始时间</Col>
          <Col class="valbox" span="6">{{ item.anesTime }} </Col>
        </Row>
      </div>

      <Row style="margin-top: 15px" class="flex row-border border-bottom-none">
        <Col span="5" class="text-label ivu-text-left"> 手术及操作代码计数</Col>
        <Col class="valbox" span="3"> </Col>
      </Row>
      <Row class="flex row-border border-bottom-none">
        <Col span="4" class="text-label ivu-text-left"> 呼吸机使用时间</Col>
        <Col class="valbox" span="2">
          {{ form?.diagInfo?.useDay }}
        </Col>
        天
        <Col class="valbox" span="2">
          {{ form?.diagInfo?.useHour }}
        </Col>
        小时
        <Col class="valbox" span="2">
          {{ form?.diagInfo?.useMinute }}
        </Col>
        分钟
      </Row>

      <div class="row-border">
        <row>
          <Col span="8" class="text-label ivu-text-left"> 颅脑损伤患者昏迷时间： 入院前 </Col>
          <Col class="valbox" span="2">{{ form?.diagInfo?.stunDay1 }} </Col> 天
          <Col class="valbox" span="2"> {{ form?.diagInfo?.stunHour1 }} </Col> 小时
          <Col class="valbox" span="2"> {{ form?.diagInfo?.stunMinute1 }} </Col> 分钟
        </row>
        <row style="margin-top: 15px">
          <span style="margin-left: 162px">入院后</span>
          <Col class="valbox" span="2">{{ form?.diagInfo?.stunDay2 }} </Col> 天
          <Col class="valbox" span="2">{{ form?.diagInfo?.stunHour2 }} </Col> 小时
          <Col class="valbox" span="2"> {{ form?.diagInfo?.stunMinute2 }} </Col> 分钟
        </row>
      </div>

      <div style="margin-top: 20px">
        <Table :columns="columns5" :data="form.diagInfo.icU_Json" border=""></Table>
      </div>
      <div style="margin-top: 5px">
        <Table :columns="columns6" :data="form.diagInfo.blood_Json" border=""></Table>
      </div>

      <Row style="margin-top: 15px" class="flex space-between row-border border-bottom-none">
        <Col span="6 flex">
          <div class="text-label">特级护理天数</div>
          <div class="valbox">{{ form.diagInfo.care0 }}</div>
        </Col>
        <Col span="6 flex">
          <div class="text-label">一级护理天数</div>
          <div class="valbox">{{ form.diagInfo.care1 }}</div>
        </Col>
        <Col span="6 flex">
          <div class="text-label">二级护理天数</div>
          <div class="valbox">{{ form.diagInfo.care2 }}</div>
        </Col>
        <Col span="6 flex">
          <div class="text-label">三级护理天数</div>
          <div class="valbox">{{ form.diagInfo.care3 }}</div>
        </Col>
      </Row>
      <div class="row-border border-bottom-none">
        <Row>
          <Col span="4" class="text-label ivu-text-left"><i class="red">*</i> 离院方式 </Col>
          <Col class="valbox" span="9">
            {{ Enum4[form.diagInfo.outWay] || '' }}
          </Col>
          <span style="margin-left: 20px">1. 医嘱离院</span>
          <span style="margin-left: 20px">2. 医嘱转院，拟接收机构名称</span>
          <Col class="valbox" span="8">
            {{ form.diagInfo.outWay == 2 ? form.diagInfo.outWay_Dept : '' }}
          </Col>
        </Row>
        <Row style="margin-top: 10px">
          <span>3. 转医嘱转社区卫生服务机构/乡镇卫生院，拟接收机构名称</span>
          <Col class="valbox" span="4">
            {{ form.diagInfo.outWay == 3 ? form.diagInfo.outWay_Dept : '' }}
          </Col>
        </Row>
        <Row style="margin-top: 10px">
          <span>4. 非医嘱离院</span>
          <span class="ml-20">5. 死亡</span>
          <span style="margin-left: 20px">9. 其他</span>
        </Row>
      </div>

      <Row class="flex space-between row-border border-bottom-none">
        <Col span="10 flex">
          <div class="text-label"><i class="red">*</i> 是否有出院31天内再住院计划</div>
          <div class="valbox">
            {{ form.diagInfo.outAgainType ? (form.diagInfo.outAgainType == 2 ? '有' : '无') : '' }}
          </div>
          1.无
        </Col>
        <Col span="14 flex">
          2.有，目的
          <div class="valbox">{{ form.diagInfo.outAgainType_Memo }}</div>
        </Col>
      </Row>
      <Row>
        <table border="1" cellpadding="5px" cellspacing="0" class="table_border_class">
          <thead>
            <tr>
              <td>
                <Row class="flex space-between">
                  <Col span="8" class="text-label ivu-text-left"
                    ><i class="red">*</i> 主诊医师姓名</Col
                  >
                  <Col class="valbox">{{ form?.personInfo?.dcName }}</Col>
                </Row>
              </td>
              <td>
                <Row class="flex space-between">
                  <Col span="8" class="text-label ivu-text-left"
                    ><i class="red">*</i> 主诊医师代码</Col
                  >
                  <Col class="valbox">{{ form?.personInfo?.dcCode }}</Col>
                </Row>
              </td>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td>
                <Row class="flex space-between">
                  <Col span="7" class="text-label ivu-text-left"> 责任护士姓名</Col>
                  <Col class="valbox">{{ form?.personInfo?.nurseName }}</Col>
                </Row>
              </td>
              <td>
                <Row class="flex space-between">
                  <Col span="7" class="text-label ivu-text-left"> 责任护士代码</Col>
                  <Col class="valbox">{{ form?.personInfo?.nurseCode }}</Col>
                </Row>
              </td>
            </tr>
          </tbody>
        </table>
      </Row>
    </div>

    <div class="title1" style="color: #ff0660">四、医疗收费信息</div>

    <Row>
      <table border="1" cellpadding="5px" cellspacing="0" class="table_border_class">
        <thead>
          <tr>
            <td style="width: 40%">
              <Row class="flex space-between" style="padding: 5px 0">
                <Col span="9" class="text-label ivu-text-left">业务流水号：</Col>
                <Col class="valbox">
                  {{ form?.chargeInfo?.chargeID }}
                </Col>
              </Row>
              <Row class="flex space-between" style="padding: 5px 0">
                <Col span="7" class="text-label ivu-text-left">票据代码：</Col>
                <Col class="valbox">
                  {{ form?.chargeInfo?.ticketCode }}
                </Col>
              </Row>
              <Row class="flex space-between" style="padding: 5px 0">
                <Col span="7" class="text-label ivu-text-left">票据号码：</Col>
                <Col class="valbox">
                  {{ form?.chargeInfo?.ticketNo }}
                </Col>
              </Row>
            </td>
            <td style="width: 60%">
              <Row class="flex">
                <Col span="4" class="text-label ivu-text-left"> 结算期间 </Col>
                <Col class="valbox" span="2">
                  {{ $timeFilter(form.chargeInfo.startDate, 'format5') }} </Col
                >年
                <Col class="valbox" span="2">
                  {{ $timeFilter(form.chargeInfo.startDate, 'format6') }} </Col
                >月
                <Col class="valbox" span="2">
                  {{ $timeFilter(form.chargeInfo.startDate, 'format7') }} </Col
                >日-
                <Col class="valbox" span="2">
                  {{ $timeFilter(form.chargeInfo.endDate, 'format5') }} </Col
                >年
                <Col class="valbox" span="2">
                  {{ $timeFilter(form.chargeInfo.endDate, 'format6') }} </Col
                >月
                <Col class="valbox" span="2">
                  {{ $timeFilter(form.chargeInfo.endDate, 'format7') }} </Col
                >日
              </Row>
            </td>
          </tr>
        </thead>
      </table>
    </Row>

    <div style="margin-top: 5px">
      <Table
        :columns="columns7"
        :data="form?.chargeInfo?.items"
        show-summary
        sum-text="金额合计"
        border=""
      ></Table>
    </div>

    <Row style="margin-top: 5px">
      <Col span="24">
        <table border="1" cellpadding="5px" cellspacing="0" class="table_border_class">
          <thead>
            <tr>
              <td colspan="2">医保统筹基金支付</td>
              <td>{{ form?.chargeInfo?.ybtcjjzf }}</td>
              <td rowspan="5">个人负担</td>
              <td rowspan="3">个人自负</td>
              <td rowspan="3">{{ form?.chargeInfo?.grzF1 }}</td>
            </tr>
            <tr>
              <td rowspan="3">补充医疗保险支付</td>
              <td>职工大额补助</td>
              <td>{{ form?.chargeInfo?.zgdebz }}</td>
            </tr>
            <tr>
              <td>居民大病保险</td>
              <td>{{ form?.chargeInfo?.jmdbbx }}</td>
            </tr>
            <tr>
              <td>公务员医疗补助</td>
              <td>{{ form?.chargeInfo?.gwyylbz }}</td>
              <td rowspan="2">个人自费</td>
              <td rowspan="2">{{ form?.chargeInfo?.grzF2 }}</td>
            </tr>
            <tr>
              <td colspan="2">医疗救助支付</td>
              <td>{{ form?.chargeInfo?.yljzzf }}</td>
            </tr>
            <tr>
              <td rowspan="3">其他支付</td>
              <td>企业补充</td>
              <td>{{ form?.chargeInfo?.qybc }}</td>
              <td rowspan="3">个人支付</td>

              <td rowspan="2">个人账户支付</td>
              <td rowspan="2">
                {{ form?.chargeInfo?.grzhzf }}
              </td>
            </tr>
            <tr>
              <td>商业保险</td>
              <td>{{ form?.chargeInfo?.sybx }}</td>
            </tr>
            <tr>
              <td></td>
              <td></td>
              <td>个人现金支付</td>
              <td>{{ form?.chargeInfo?.grxjzf }}</td>
            </tr>
          </thead>
        </table>
      </Col>
    </Row>

    <Row style="margin-top: 15px" class="flex row-border">
      <Col span="4" class="text-label ivu-text-left"> 医保支付方式</Col>
      <Col class="valbox" span="3"> {{ payEnum[form?.chargeInfo?.payType] }} </Col>1.按项目 2.单病种
      3.按病种分值 4.DIP 5.按床日 6.按人头
    </Row>
    <Row>
      <Col span="24">
        <table border="1" cellpadding="5px" cellspacing="0" class="table_border_class">
          <thead>
            <tr>
              <td>
                <Row class="flex space-between">
                  <Col span="12" class="text-label ivu-text-left"> 定点医疗机构填报部门</Col>
                  <Col class="valbox">
                    {{ form?.chargeInfo?.section }}
                  </Col>
                  <Col span="12" class="text-label ivu-text-left"> 医保经办机构</Col>
                  <Col class="valbox">
                    {{ form?.chargeInfo?.dept }}
                  </Col>
                </Row>
                <Row class="flex space-between">
                  <Col span="12" class="text-label ivu-text-left"> 定点医疗机构填报人</Col>
                  <Col class="valbox">
                    {{ form?.chargeInfo?.fillPerson }}
                  </Col>
                  <Col span="12" class="text-label ivu-text-left"> 医保机构经办人</Col>
                  <Col class="valbox">
                    {{ form?.chargeInfo?.doPerson }}
                  </Col>
                </Row>
              </td>
            </tr>
          </thead>
        </table>
      </Col>
    </Row>
  </div>
</template>

<script setup>
import { reactive } from 'vue'

import { gjInfoEnum, mzInfoEnum, kbInfoEnum, mzfsInfoEnum } from '../unils/infoEnum.js'

const props = defineProps({
  form: Object,
  classList: Array,
})

const diagItems = ref([
  {
    diid: '',
    listID: '',
    type: 1,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 1,
    way: 2,
    name: '',
    code: '',
    desc: '',
  },
])

diagItems.value =
  props.form.diagInfo.diagItems.length > 0 ? props.form.diagInfo.diagItems : diagItems.value
console.log(props.form.diagInfo, 12123)
// 在计算属性中添加空值检查
const groupedItems = computed(() => {
  console.log('groupedItems', props.form?.diagInfo?.diagItems)
  if (!props.form?.diagInfo?.diagItems?.length) {
    console.warn('diagItems is empty')
    return []
  }

  const result = []
  const items = diagItems.value

  for (let i = 0; i < items.length; i += 2) {
    const defaultSecondItem = {
      diid: '',
      listID: '',
      type: items[i].type,
      way: 2, // 中医诊断
      name: '',
      code: '',
      desc: '',
    }

    result.push([items[i], items[i + 1] || defaultSecondItem])
  }
  return result
})

const classMethod = (val) => {
  return props.classList?.find((item) => item.label === val)?.value || ''
}

const columns1 = [
  {
    title: '病种名称',
    align: 'center',
    key: 'diseaseName',
  },
  {
    title: '病种代码',
    align: 'center',
    key: 'diseaseCode',
  },
  {
    title: '手术及操作名称',
    align: 'center',
    key: 'operName',
  },
  {
    title: '手术及操作代码',
    align: 'center',
    key: 'operCode',
  },
]

const columns2 = [
  {
    title: '出院西医诊断',
    slot: 'redName',
    align: 'center',
    renderHeader: (h) =>
      h('span', [
        h('span', { style: { color: 'red', 'margin-right': '2px' } }, '*'),
        h('span', '出院西医诊断'),
      ]),
  },
  {
    title: '病种代码',
    slot: 'redCode',
    align: 'center',
    renderHeader: (h) =>
      h('span', [
        h('span', { style: { color: 'red', 'margin-right': '2px' } }, '*'),
        h('span', '病种代码'),
      ]),
  },
  { title: '入院病情', align: 'center', slot: 'redDesc' },
  { title: '出院中医诊断', align: 'center', slot: 'greenName' },
  { title: '病种代码', align: 'center', slot: 'greenCode' },
  { title: '入院病情', align: 'center', slot: 'greenDesc' },
]
const dataList2 = reactive([])

const payEnum = {
  1: '按项目',
  2: '单病种',
  1: '按病种分值',
  2: 'DIP',
  1: '按床日',
  2: '按人头',
}

const sexEnum = {
  0: '未知的性别',
  1: '男',
  2: '女',
  9: '未说明的性别',
}

const certTypeEnum = {
  '01': '居民身份证',
  '02': '居民户口本',
  '03': '护照',
  '04': '军官证',
  '05': '驾驶证',
  '06': '港澳居民来往内地通行证',
  '07': '台湾居民来往内地通行证',
  '08': '母亲身份证',
  99: '其他法定有效证件',
}

const zyEnum = {
  11: '国家公务员',
  13: '专业技术人员',
  17: '职员',
  21: '企业管理人员',
  24: '工人',
  27: '农民',
  31: '学生',
  37: '现役军人',
  51: '自由职业者',
  54: '个体经营者',
  70: '无业人员',
  80: '退（离）休人员',
  90: '其他',
}

const gxEnum = {
  1: '本人',
  2: '户主',
  10: '配偶',
  11: '夫',
  12: '妻',
  20: '子',
  50: '父母',
  51: '父亲',
  52: '母亲',
}

const ybEnum = {
  1: '城镇职工基本医疗保险',
  2: '城镇居民基本医疗保险',
  3: '新型农村合作医疗',
  4: '贫困救助',
  5: '商业医疗保险',
  6: '全公费',
  7: '全自费',
  8: '其他社会保险',
  9: '其他',
  '01': '城镇职工基本医疗保险',
  '02': '城镇居民基本医疗保险',
  '03': '新型农村合作医疗',
  '04': '贫困救助',
  '05': '商业医疗保险',
  '06': '全公费',
  '07': '全自费',
  '08': '其他社会保险',
  '09': '其他',
  99: '其他',
}

const tsEnum = {
  1: '特困人员',
  2: '城乡低保对象',
  3: '农村建档立卡贫困人口',
  4: '贫困重度残疾人',
  9: '其他',
}
const xhEnum = {
  1: '正常新生儿',
  2: '早产儿',
  3: '有疾病新生儿',
  4: '非无菌分娩',
  9: '其他',
}

const Enum1 = {
  1: '住院',
  2: '日间手术',
}
const Enum2 = {
  1: '急诊',
  2: '门诊',
  3: '其他医疗机构转入',
  4: '其他',
}

const Enum3 = {
  1: '西医',
  2.1: '中医',
  2.2: '民族医',
  3: '中西医',
}
const Enum4 = {
  1: '医嘱离院',
  2: '医嘱转院，拟接收机构名称',
  3: '转医嘱转社区卫生服务机构/乡镇卫生院，拟接收机构名称',
  4: '非医嘱离院',
  5: '死亡',
  9: '其他',
}

const columns5 = [
  {
    title: '重症监护病房类型（CUU、NICU、ECU、SICU、PICU、RICU、ICU(综合)、其他） ',
    align: 'center',
    key: 'type',
    renderHeader: (h) =>
      h('div', [
        h('div', '重症监护病房类型'),
        h('div', '（CUU、NICU、ECU、SICU、'),
        h('div', 'PICU、RICU、ICU(综合)、其他）'),
      ]),
  },
  {
    title: '进重症监护室时间',
    align: 'center',
    key: 'intime',
    renderHeader: (h) => h('div', [h('div', '进重症监护室时间'), h('div', '（_年_月_日_时_分）')]),
  },
  {
    title: '出重症监护室时间',
    align: 'center',
    key: 'outtime',
    renderHeader: (h) => h('div', [h('div', '出重症监护室时间'), h('div', '（_年_月_日_时_分）')]),
  },
  {
    title: '合计（_时_分）',
    align: 'center',
    key: 'total',
  },
]

const columns6 = [
  {
    title: '输血品种',
    align: 'center',
    key: 'type',
  },
  {
    title: '输血量',
    align: 'center',
    key: 'amount',
  },
  {
    title: '输血计量单位',
    align: 'center',
    key: 'unit',
  },
]

const columns7 = [
  {
    title: '项目名称',
    align: 'center',
    key: 'itemName',
  },
  {
    title: '金额',
    align: 'center',
    key: 'amount',
  },
  {
    title: '甲类',
    align: 'center',
    key: 'jia',
  },
  {
    title: '乙类',
    align: 'center',
    key: 'yi',
  },
  {
    title: '自费',
    align: 'center',
    key: 'self',
  },
  {
    title: '其他',
    align: 'center',
    key: 'others',
  },
]

watch(
  () => props.form,
  (newVal) => {
    if (newVal?.diagInfo?.diagItems) {
      diagItems.value =
        newVal.diagInfo.diagItems.length > 0 ? newVal.diagInfo.diagItems : diagItems.value
    }
  },
  {
    deep: true,
    immediate: true,
  },
)
</script>

<style lang="less" scoped>
.main_img {
  width: 13px;
  height: 13px;
}

// v::deep.ivu-btn {
//     padding: 0 10px !important;
// }

.list-detail {
  width: 100%;
  height: 100%;
  background-color: #fff;

  .btn {
    width: 100%;
    text-align: right;
    margin-bottom: 10px;
  }

  .flex {
    display: flex;
  }

  .space-between {
    justify-content: space-between;
  }

  .list-main {
    height: 100%;

    .left {
      flex: 1;

      .main-table {
        width: 100%;
        max-height: 82vh;
        overflow-y: auto;
        border: 2px solid #000;
        padding: 10px 6px;
        background-color: #f5f7f9;
        // display: flex;
        // justify-content: space-between;

        .title1 {
          height: 70px;
          color: #000;
          display: flex;
          justify-content: center;
          align-items: center;
          background-color: #edf1fc;
          margin: 15px 0;
          font-size: 20px;
        }
      }
    }

    .right {
      width: 500px;
      border: 1px solid #ccc;
    }
  }
}

:deep(.ivu-cell-label) {
  line-height: 1.2;
  font-size: 15px;
  color: #808695;
}

.ml-20 {
  margin-left: 20px;
}

.valbox {
  flex: 1;
  border-bottom: 1px solid;
  padding-left: 2px;
  text-align: left;
  background-color: #fff;
  padding-left: 5px;
}

// .ivu-row {
//     padding-top: 10px;
// }

.underline {
  text-decoration: underline;
  text-underline-offset: 0.5em;
}

/* styles.css */
td {
  padding: 5px;
  border: 1px solid #ccc;
}

/deep/.text-label {
  padding: 0 5px;
  flex-basis: auto;
  width: auto;
}

.red {
  color: red;
}

/deep/ .ivu-table .ivu-table-header th {
  background-color: #fff;
}

.row-border {
  border: 1px solid #ccc;
  padding: 10px 5px;
  box-sizing: border-box;
}

.no-padding {
  padding: 0;
}

.border-bottom-none {
  border-bottom: none;
}

.border-right-none {
  border-right: none;
}

.opertion_list {
  border: 1px solid #000;
  padding: 20px;
  margin-bottom: 10px;

  .action_box {
    width: 100%;
    height: 30px;
    display: flex;
    justify-content: space-between;

    .choose_box {
      height: 30px;
      width: 70px;
      display: flex;
    }

    .other_box,
    .other_box1 {
      flex: 1;
      height: 30px;
      border: 1px dashed #5b9bd5;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
    }

    .other_box1 {
      border: 1px dashed #ff6347;
    }
  }
}

.table_border_class {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  text-align: center;
}

.table-container {
  padding: 20px;
}

/deep/ .table-container .ivu-form-item-content {
  margin-left: 0 !important;
}

.my-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #fff;
}

.my-table th,
.my-table td {
  border: 1px solid #ddd;
  width: 14.5%;
  padding: 12px;
  text-align: center;
  overflow: hidden;
}

.my-table td {
  min-height: 42px;
}

.my-table th {
  background-color: #f4f4f4;
  font-weight: bold;
}

.my-table input {
  width: 100%;
  padding: 5px;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: center;
}

.my-table tbody tr:hover {
  background-color: #ebf7ff;
}
</style>
